<template>
    <view class="list">
        <Nav :isBack="false" :showRight="false"></Nav>
        <view class="list_box" @click="open(1)">
            <view>
                <text class="list-title">隐私政策</text>
            </view>
            <view class="right" src="./right.png"></view>
        </view>
        <view class="list_box" @click="open(2)">
            <view>
                <text class="list-title">用户协议</text>
            </view>
            <view class="right" src="./right.png"></view>
        </view>
        <view class="list_box" @click="open(3)">
            <view>
                <text class="list-title">联系客服</text>
            </view>
            <view class="right" src="./right.png"></view>
        </view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            userInfo: [],
            user: [],
            show: false,
            appInfo: {},
        };
    },
    props: {},
    onLoad: function (e) {
        // #ifdef APP-PLUS
        plus.runtime.getProperty(plus.runtime.appid, widgetInfo => {
            this.appInfo = JSON.stringify(widgetInfo);
            // this.appInfo = widgetInfo;
        });
        // #endif
        // #ifdef MP-QQ
        qq.showShareMenu({
            showShareItems: ["qq", "qzone", "wechatFriends", "wechatMoment"],
        });
        // #endif
    },
    methods: {
        open(type) {
            if (type === 1) {
                uni.navigateTo({
                    url:
                        "/pages/web/web?url=" +
                        "https://campaign.snmi.cn/treaty/privacy/index.html?subject=上海倍效网络科技有限公司",
                });
            }
            if (type === 2) {
                uni.navigateTo({
                    url:
                        "/pages/web/web?url=" +
                        "https://campaign.snmi.cn/treaty/user/index.html?subject=上海倍效网络科技有限公司",
                });
            }
            if (type === 3) {
                this.show = true;
                uni.showModal({
                    title: "提示",
                    content: "客服微信:snmi001",
                    cancelText: "复制",
                    success: res => {
                        if (res.confirm) {
                            console.log("用户点击确定");
                        } else if (res.cancel) {
                            uni.setClipboardData({
                                data: "snmi001",
                                success: () => {
                                    uni.showToast({
                                        title: "复制成功",
                                        duration: 1000,
                                    });
                                },
                            });
                        }
                    },
                });
            }
        },
        editInfo: function () {
            uni.navigateTo({
                url: "/pages/user-info/index",
            });
        },
        toAnalyze: function () {
            uni.navigateTo({
                url: "/pages/width-analyze/index",
            });
        },
        toWeightRecord: function () {
            uni.navigateTo({
                url: "/pages/width-record/index",
            });
        },
    },
    onBackPress() {
        // #ifdef APP-PLUS
        uni.sendNativeEvent(
            "exitapp",
            { appId: plus.runtime.appid },
            ret => {}
        );
        plus.runtime.quit();
        // #endif
        return true;
    },
};
</script>
<style scoped>
.list {
    width: 100%;
}
.list .list_box {
    padding: 28rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.list .list_box .right {
    width: 48rpx;
    height: 48rpx;
    background-image: url("");
    background-size: 100% 100%;
}
</style>
